import type { Corpus } from './model/corpus';

import type { BaseListReq, BaseListResp } from '#/api/model/baseModel';

import { requestClient } from '#/api/request';

enum CorpusType {
  Corpus = '/cs-api/corpus',
  GetCorpusList = '/cs-api/corpus_list',
}

/**
 * @description: Get corpus list
 */
export const getCorpusList = (params: BaseListReq) => {
  return requestClient.get<BaseListResp<Corpus>>(CorpusType.GetCorpusList, {
    params,
  });
};

/**
 * @description: Delete corpus by id
 */
export const deleteCorpus = (id: string) => {
  return requestClient.delete(`${CorpusType.Corpus}/${id}`);
};

/**
 * @description: Detail corpus by id
 */
export const detailCorpus = (id: string) => {
  return requestClient.get(`${CorpusType.Corpus}/${id}`);
};

/**
 * @description: Add corpus
 */
export const addCorpus = (data: any) => {
  return requestClient.post(CorpusType.Corpus, data);
};

/**
 * @description: Update corpus
 */
export const updateCorpus = (data: any) => {
  return requestClient.put(CorpusType.Corpus, data);
};
